#include <xp/bas/fio.h> 
#include <xp/bas/stdio.h> 

int xp_main (void)
{
	xp_fio_t fio;
	xp_mchar_t buf[10] = { 'a', 'b', 'c' };

	if (xp_fio_open(&fio, XP_TEXT("fio.txt"), 
		XP_FIO_READ | XP_FIO_WRITE | XP_FIO_CREATE | XP_FIO_TRUNCATE, 0600) == XP_NULL) {
		xp_printf (XP_TEXT("cannot open file\n"));
		return -1;
	}

	//xp_fio_seek (&fio, XP_TYPE_MAX(xp_int32_t), XP_FIO_SEEK_CURRENT); 
	xp_fio_seek (&fio, 2000, XP_FIO_SEEK_CURRENT); 
	xp_fio_write (&fio, buf, 3);
#ifdef linux
{
char cmd[1000];
snprintf (cmd, sizeof(cmd), "ls -l /proc/%d/fd", getpid());
system (cmd);
}
#endif
	xp_fio_close (&fio);

#ifdef linux
{
char cmd[1000];
snprintf (cmd, sizeof(cmd), "ls -l /proc/%d/fd", getpid());
system (cmd);
}
#endif
	return 0;
}
